//
// Created by 29019 on 2019/5/2.
//
#ifndef CUTILS_UTILS_H
#define CUTILS_UTILS_H

#include <string>
#include "debug.h"
#include <sys/types.h>
#include <stdio.h>
#include <stdarg.h>


using namespace std;
// 字节序选择
typedef enum{
    BIG_ENDIAN_TYPE,  // 大端
    LITTLE_ENDIAN_TYPE // 小端
}BYTE_ORDER_TYPE;

typedef enum {
    ENV_WINDOWS = 1,
    ENV_LINUX,
    ENV_UNIX,
    ENV_NONE,
}ENV_SYS;

typedef enum{
    GCC = 1,
    CLANG = 2,
    CL = 3,
    UNKNOWN
}ENV_COMPILER;
inline ENV_SYS CurrentEnvSys();
inline ENV_COMPILER CurrentEnvCompiler();

#define RELEASE_MEMORY(x)  \
    do {  \
        if(nullptr == x) \
        {  \
            delete(x); \
            x = nullptr;\
        } \
    }while(0) 

string itos(int x);

BYTE_ORDER_TYPE HostByteOrder();

// 限制float精确度
float LimitFloat(float in,int size);


#endif //CUTILS_UTILS_H
